<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
switch ($data->type) {
    case 'project':
        $data = ArtistProject::model()->findByPk($data->real_id);
        if($data != null){
            $title = $data->title;
            $create_time = null;
            $description = $data->description;
            $url = Yii::app()->createUrl('/artistProject/view',array('id'=>$data->id));
        }
        break;
    case 'artist':
        $data = Artist::model()->findByPk($data->real_id);
        if($data != null){
            $title = $data->name;
            $create_time = null;
            $description = $data->io;
            $url = Yii::app()->createUrl('/artist/view',array('id'=>$data->id));
        }
        break;
    case 'blog':
        $data = Blog::model()->findByPk($data->real_id);
        if($data != null){
            $title = $data->title;
            $create_time = $data->create_time;
            $description = $data->discription;
            $url = Yii::app()->createUrl('/blog/view',array('id'=>$data->id));
        }
        break;
    case 'shop':
        $data = Shop::model()->findByPk($data->real_id);
        if($data != null){
            $title = $data->title;
            $create_time = null;
            $description = $data->discription;
            $url = Yii::app()->createUrl('/shop/view',array('id'=>$data->id));
        }
        break;
    default :
        //$this->render('/artistProject/_view',array('model'=>$home));
        break;
}
?>
<div class="view">
    <div class="left leftright">
        <h2><?php echo $title; ?></h2>
    </div>
    <div class="right leftright body">
        <div class="blog_header">
            <div class="left" id="cearte_time">
            <?php if($create_time != null) echo Tool::ago($create_time); ?>
            </div>
            <div class="clear"></div>
        </div>
        <div class="blog_body">
        <?php
        echo '<div class="blog_text">';
        echo nl2br(Tool::character_limiter(Tool::delete_htm($description), 500));
        echo '</div>';
        ?>
        </div>
        <?php echo '<h3 class="read_more">'.CHtml::link('Read More',$url).'</h3>'; ?>
    </div>
    <div class="clear"></div>
</div>